package factory.methodfactory.order;

import factory.methodfactory.dumpling.Dumpling;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public abstract class OrderDumpling {

    abstract Dumpling createDumpling(String orderType);

    public OrderDumpling(){
        Dumpling dumpling = null;
        String orderType;
        do{
            orderType = getType();
            dumpling = createDumpling(orderType);
            dumpling.prepare();
            dumpling.pack();
            dumpling.cook();
        }while(true);


    }
    public String getType(){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("input dumpling type:");
        String str = "";
        try {
            str = reader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}
